package com.example.pm.ending.server.controller;

import com.example.pm.ending.server.module.admin.AddNewAdminEntityDTO;
import com.example.pm.ending.server.module.admin.AdminListEntityVO;
import com.example.pm.ending.server.module.admin.UpdateAdminEntityDTO;
import com.example.pm.ending.server.pojo.vo.RoleListVO;
import com.example.pm.ending.server.service.IAdminModuleService;
import com.example.pm.ending.server.service.IRoleModuleService;
import com.example.pm.ending.server.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.Range;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 处理角色相关请求的控制器
 *
 * @author java@tedu.cn
 * @version 0.0.1
 */
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("/roles")
@Api(tags = "5. 角色管理模块")
public class RoleController {

    @Autowired
    private IRoleModuleService roleModuleService;

    public RoleController() {
        log.debug("创建控制器类对象：RoleController");
    }

    // http://localhost:9081/roles
    @ApiOperation("查询角色列表")
    @ApiOperationSupport(order = 420)
    @GetMapping("")

    public JsonResult<List<RoleListVO>> list() {
        log.debug("开始处理【查询角色列表】的请求，参数：无");
        List<RoleListVO> list = roleModuleService.list();
        return JsonResult.ok(list);
    }

}